$.getScript("targetsConnect/public.js",function(){
	sendConnectAjax("#connectZheTime_select",create_Connectzhexian);
}); 

$("#connectZhesubmit").click(function(){
	$("#connectZhe").remove();
	sendConnectAjax("#connectZheTime_select",create_Connectzhexian);
});
function create_Connectzhexian(xml_data){
	var div = $("<div>").attr("id","connectZhe").addClass("graphCss");
	$("#Connectb_info").append(div).height($("#contentWarpper").height()-$(".top_menu").height());
	var x_name=[];var data4=[];var data5=[];var data6=[];var date=[];var vdnArr={};
	var size=$("#Connectb_info").parent().parent().data("highChartNum");
	  	$(xml_data).find("row").each(function(i){
	  		if(i+1>size && size!=0)
				return false;
  			var col1 = $(this).get(0).attributes.getNamedItem("col1").nodeValue;
  			var vdnMap={};
			var col3 = $(this).get(0).attributes.getNamedItem("col2").nodeValue;//vdn
	  		var col4 = parseInt($(this).get(0).attributes.getNamedItem("col3").nodeValue);//呼入数
	  		var col5 = parseInt($(this).get(0).attributes.getNamedItem("col4").nodeValue);//接通数
		  	var col6 = $(this).get(0).attributes.getNamedItem("col5").nodeValue;//接通率
			col6=parseFloat(col6)*100;
	 		if(col6.toString().split('.')[1])
	 			col6=col6.toFixed(2);
	 		
	 		vdnMap.y=parseInt(col6);
	 		vdnMap.data4=parseInt(col4);
	 		vdnMap.data5=parseInt(col5);
	 		vdnMap.data1=col1;
  			vdnMap.vdn=col3;
  			if($.inArray(col1,x_name)==-1)
  				x_name.push(col1);
  			if(!vdnArr[col3]){
  				vdnArr[col3]=[];
			}
			vdnArr[col3].push(vdnMap);
	  	});
	  	var serviceList=[];
	  	$.each(vdnArr,function(key,value){
		  	var serviceMap={
	                name: key,
	                data: value,
	                dataLabels: {
	                    enabled: true,
	                    rotation: 0,
	                    color:CONFIG_PARAMS.GraphFontColor,
	                    align: 'right',
	                    x: 10,
	                    y: 23,
	                    style: {
	                        fontSize: '13px',
	                        fontFamily: 'Verdana, sans-serif',
	                        textShadow: '0 0 3px black'
	                    }
	            	}
				};
				serviceList.push(serviceMap);
	  	});
	  	
         $('#connectZhe').highcharts({
            chart: {
                type: 'line',
                backgroundColor:CONFIG_PARAMS.GraphBackColor
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: x_name,
                labels : { 
	                style:{
	            		color:CONFIG_PARAMS.GraphFontColor
	            	}
	            }
            },
            yAxis: {
                min: 0,
                max:100,
                title: {
                    text: '百分比',
                    style:{
	            		color:CONFIG_PARAMS.GraphFontColor
	            	}
                },
	            labels : {  
	                formatter : function() {
	                 return this.value + '%';  
	                },style:{
	            		color:CONFIG_PARAMS.GraphFontColor
	            	}
	            }
            },
            legend:{
	        	itemStyle: {
                	color: CONFIG_PARAMS.GraphFontColor
            	}
	        },
            tooltip: {
				formatter: function() {
	                var s='<b>'+this.x +'</b>';
	                $.each(this.points, function(i, point) {
	            		s += '<br/><span style="color:#DD22DD"> VDN : '+ point.point.vdn +'</span>';
	                	s += '<br/><span style="color:#22B14C"> 呼入数 : '+ point.point.data4 +'</span>';
	                    s += '<br/><span style="color:red"> 接通数 : '+ point.point.data5 +'</span>';
	                    s += '<br/><span style="color:'+point.series.color+'"> 接通率: '+ point.y +'%</span>';
	                });
	                return s;
	            },
                shared: true
            },
            plotOptions: {
                column: {
                    stacking: 'normal'
                }
            },
                series: serviceList
        });
}